/*
 * @Author: KKKKKK
 * @Date: 2021-01-10 16:25:41
 * @LastEditors: KKKKKK
 * @LastEditTime: 2021-01-10 16:25:41
 */
/*
 * @Author: KKKKKK
 * @Date: 2021-01-10 12:08:35
 * @LastEditors: KKKKKK
 * @LastEditTime: 2021-01-10 12:08:35
 */
import axios from './config'
import url from './url'
const baseUrl = process.env.VUE_APP_BASE_URL

/* 托管信息类 */
// 新增字典类型
const dataGroupCreate = (params) => axios.post(baseUrl + url.datatype.createGroup, params)

// 删除字典类型
const dataGroupDelete = (id) => axios.delete(baseUrl + url.datatype.deleteGroup + `/${id}`)

// 修改字典类型
const dataGroupUpdate = (params, id) => axios.post(baseUrl + url.datatype.updateGroup + `/${id}`, params)

// 获取某个字典类型
const dataGroupLoad = (id) => axios.get(baseUrl + url.datatype.loadGroup + `/${id}`)

// 获取字典类型列表
// mark：page分页 list不分页 count总数
const dataGroupPage = (params) => axios.get(baseUrl + url.datatype.pageGroup, { params })

// 获取字典类型下的字典详情列表
const groupListPage = (params) => axios.get(baseUrl + url.datatype.groupList, { params })

// 新增字典详情
const datatypeCreate = (params) => axios.post(baseUrl + url.datatype.create, params)

// 删除字典详情
const datatypeDelete = (id) => axios.delete(baseUrl + url.datatype.delete + `/${id}`)

// 修改字典详情
const datatypeUpdate = (params, id) => axios.post(baseUrl + url.datatype.update + `/${id}`, params)

// 获取某个字典详情
const datatypeLoad = (id) => axios.get(baseUrl + url.datatype.load + `/${id}`)

// 获取字典详情列表
// mark：page分页 list不分页 count总数
const datatypePage = (params) => axios.get(baseUrl + url.datatype.page, { params })

export default {
  dataGroupCreate,
  dataGroupDelete,
  dataGroupUpdate,
  dataGroupLoad,
  dataGroupPage,
  datatypeCreate,
  datatypeDelete,
  datatypeUpdate,
  datatypeLoad,
  groupListPage,
  datatypePage,
}
